'use strict';

module.exports = function collectSameElements(collectionA, objectB) {
    var a=[];
    var arr=[];
    for(var ai=0;ai<collectionA.length;ai++){
      a.push(collectionA[ai].key);
    }
    console.log(a);
    let b=objectB.value;
    console.log(b);
    for(var i=0;i<a.length;i++){
      for(var j=0;j<b.length;j++){
        if(a[i]==b[j]){
          arr.push(a[i]);
        }
      }
    }
  return arr;
  console.log(arr);
}
// const collectionA = [
//   {key: 'a'}, {key: 'e'}, {key: 'h'}, {key: 't'}, {key: 'f'}, {key: 'c'}, {key: 'g'}, {key: 'b'}, {key: 'd'}
// ];
// const collectionB = {value: ['a', 'd', 'e', 'f']}; 
// console.log(collectSameElements(collectionA, collectionB));
